import './ViewPanel.scss';
import { connect } from 'react-redux';
import * as React from 'react';
import { WorkView } from '../../config/workViews';

interface IProps {
  views: WorkView[];
}

const Views = ({ views }: IProps) => {
  return (
    <div className='views-wrap'>
      {views.map(view => (
        <div className='view-item' key={view.id} style={{ display: view.isActive ? 'block' : 'none' }}>
          <view.component isActive={view.isActive} />
        </div>
      ))}
    </div>
  );
};

const mapStateToProps = (state: any) => ({
  views: state.workViewReducer
});

export default connect(mapStateToProps)(Views);
